﻿using System;
using System.Data;
using DAO;
using DTO;

namespace BLO
{
    public class ChatLieu_Blo 
    {
        private readonly ChatLieu_Dao _chatLieuDao = new ChatLieu_Dao();


        public DataTable GetAllObject()
        {
            DataTable lstChatLieu = _chatLieuDao.GetAllObject();
            return lstChatLieu;
        }

        public int AddObject(ChatLieu_Dto obj)
        {
            if (string.IsNullOrEmpty(obj.MaChatLieu) || string.IsNullOrEmpty(obj.TenChatLieu)) return -1;
            return _chatLieuDao.AddObject(obj);
        }

        public int EditObject(string id, ChatLieu_Dto newObj)
        {
            if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(newObj.TenChatLieu)) return -1;
            return _chatLieuDao.EditObject(id, newObj);
        }

        public int DeleteObject(string id)
        {
            if (string.IsNullOrEmpty(id)) return -1;
            return _chatLieuDao.DeleteObject(id);
        }

        public int AutoIncrementIdObject()
        {
            return _chatLieuDao.AutoIncrementIdObject();
        }
    }
}